package user;

import operation.*;

import java.util.Scanner;

/**
 * 普通用户
 */
public class NormalUser extends User{

    //在子类构造方法中调用父类构造方法完成父类name的初始化
    public NormalUser(String name) {
        super(name);

        this.iOperations = new IOperation[] {
                new Exit(),
                new Find(),
                new Borrow(),
                new Return()
        };
    }

    public int menu() {
        System.out.println("*********************************");
        System.out.println("hello "+this.getName()+" 欢迎来到图书小练习！");
        System.out.println("*********************************");
        System.out.println("1、查找图书     2、借阅图书");
        System.out.println("3、归还图书     0、退出系统");
        System.out.println("*********************************");

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你的选择:>");
        int choice = scanner.nextInt();

        while(choice <0 || choice>=4) {
            System.out.println("输入错误，请重新选择！");
            System.out.println("请输入你的选择:>");
            choice = scanner.nextInt();
        }
        return choice;

    }
}
